<link href="/shop/templates/default/css/base.css" rel="stylesheet" type="text/css">
<link href="/shop/templates/default/css/seller_center.css" rel="stylesheet" type="text/css">
<style>
    .ncsc-form-default .ncsc-upload-thumb.store-banner p img {
        max-height: 450px;
        max-width: 300px;
    }
</style>
<div class="page">
    <div class="fixed-bar">
        <div class="item-title">
            <div class="subject">
                <h3>app启动页</h3>
                <h5>app启动页广告图片上传</h5>
            </div>
        </div>
    </div>
    <div class="explanation" id="explanation">
        <div class="title" id="checkZoom"><i class="fa fa-lightbulb-o"></i>
            <h4 title="<?php echo $lang['nc_prompts_title'];?>"><?php echo $lang['nc_prompts'];?></h4>
            <span id="explanationZoom" title="<?php echo $lang['nc_prompts_span'];?>"></span> </div>
        <ul>
            <li>上传app启动页图片后，每次打开app都会显示该图片，设置链接后点击图片就会跳转到设置的链接，请确保该链接为商城内部链接，否则无法回到商城</li>
        </ul>
    </div>
<div class="ncsc-form-default">
    <form method="post" action="/admin/modules/mobile/index.php?act=mb_adv&op=index" enctype="multipart/form-data" id="my_store_form">
        <input type="hidden" name="form_submit" value="ok" />
        <dl>
            <dt>广告图片 </dt>
            <dd>
                <div class="ncsc-upload-thumb store-banner" style="width:301px;height: 451px;" nctype="store_banner">
                    <p style="width:300px;height: 450px;"><?php if(!$output['mb_adv_img']){?>
                            <i class="icon-picture"></i>
                        <?php }else{?>
                            <img src="<?php echo UPLOAD_SITE_URL.'/'.ATTACH_MOBILE.'/app/'.$output['mb_adv_img'];?>" width="300" height="450"/>
                        <?php }?></p>
                </div>
                <div class="ncsc-upload-btn"> <a href="javascript:void(0);"><span>
          <input type="file" hidefocus="true" size="1" class="input-file" name="mb_adv_img" id="storeBannerPic" nc_type="change_store_banner"/>
          </span>
                        <p><i class="icon-upload-alt"></i>图片上传</p>
                    </a> </div>
                <p class="hint">上传图片最佳尺寸414*736，格式为png</p>
            </dd>
        </dl>
        <dl class="row">
            <dt class="tit">
                <label for="link_catetory">
                    跳转链接
                </label>
            </dt>
            <dd class="opt">
                <input  class="input-txt" style="width:500px;" name="mb_adv_link" value="<?php echo $output['mb_adv_link']; ?>" type="text">
                <span class="err"></span>
                <p class="notic">链接必须是以http://开头</p>
            </dd>
        </dl>
        <div class="bottom">
            <label class="submit-border"><input type="submit" class="submit" value="保存" /></label>
        </div>
    </form>
</div>
<script type="text/javascript" src="<?php echo RESOURCE_SITE_URL;?>/js/ajaxfileupload/ajaxfileupload.js"></script>
<script type="text/javascript" src="<?php echo RESOURCE_SITE_URL;?>/js/jquery.Jcrop/jquery.Jcrop.js"></script>
<link href="<?php echo RESOURCE_SITE_URL;?>/js/jquery.Jcrop/jquery.Jcrop.min.css" rel="stylesheet" type="text/css" id="cssfile2" />
<script type="text/javascript">
    var SITEURL = "<?php echo SHOP_SITE_URL; ?>";
    $(function(){
        $('#_pic').change(uploadChange);
        function uploadChange(){
            var filepath=$(this).val();
            var extStart=filepath.lastIndexOf(".");
            var ext=filepath.substring(extStart,filepath.length).toUpperCase();
            if(ext!=".PNG"&&ext!=".GIF"&&ext!=".JPG"&&ext!=".JPEG"){
                alert("file type error");
                $(this).attr('value','');
                return false;
            }
            if ($(this).val() == '') return false;
            ajaxFileUpload();

        }
        function ajaxFileUpload()
        {
            $.ajaxFileUpload({
                    url:'/index.php?act=admincut&op=pic_upload&form_submit=ok&&uploadpath=<?php echo ATTACH_MOBILE;?>',
                    secureuri:false,
                    fileElementId:'_pic',
                    dataType: 'json',
                    success: function (data, status)
                    {
                        if (data.status == 1){
                            ajax_form('cutpic','<?php echo $lang['nc_cut'];?>','/index.php?act=admincut&op=pic_cut&x=300&y=450&resize=1&url='+data.url,680);
                        }else{
                            alert(data.msg);$('#_pic').bind('change',uploadChange);
                        }
                    },
                    error: function (data, status, e)
                    {
                        alert('上传失败');$('#_pic').bind('change',uploadChange);
                    }
                }
            )
        };
        $('input[nc_type="change_store_banner"]').change(function(){
            var src = getFullPath($(this)[0]);
            $('div[nctype="store_banner"]').find('p').html('<img width="300" height="450" src="'+src+'">');
        });
    });
</script>